import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  //首页
  {
    path: '/index',
    name: 'Index',
    component: () => import('../views/index.vue')
  },
  //总的列表
  {
    path: '/totals',
    name: 'Totals',
    component: () => import('../views/totals_list.vue')
  },
  //one页面列表
  {
    path: '/one',
    name: 'One',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/one_list.vue')
  },
  //搜索页面
  {
    path: '/find',
    name: 'Find',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/find.vue')
  },
    //详情页面
    {
      path: '/details',
      name: 'Details',
      component: () => import('../views/one_details.vue')
    },
    //解锁页面
    {
      path: '/jiesuo',
      name: 'Jiesuo',
      component: () => import('../views/jiesuo.vue')
    },
     //广场页面
  {
    path: '/public',
    name: 'Public',
    component: () => import('../views/public_area.vue'),
    children:[
      {
        path: 'about',
        name: 'About',
        component: () => import('../views/public/about.vue')
      },
      {
        path: 'public',
        name: 'Public',
        component: () => import('../views/public/public.vue')
      }

    ]
  },

  //登录页面
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/login.vue')
  },
   //注册页面
   {
    path: '/register',
    name: 'Register',
    component: () => import('../views/register.vue')
  },
  {path:"/",redirect:"/login"},
  {
    path: '/*',
    name: 'no',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/no.vue')
  },
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
